<script setup lang="ts">
import { ref, watch } from 'vue';

const totalCount = ref(10)

const msg = ref('震惊！')

watch([totalCount, msg], (newValue, oldValue) => {
  console.log('totalCount 或 msg 变化了', { newValue, oldValue })
})


</script>

<template>
  <p>计数器：{{ totalCount }}</p>
  <p>{{ msg }}</p>
  <button @click="totalCount++">点击+1</button>
  <button @click="msg += '！'">点击继续震惊</button>
</template>
